﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <!--ProgressBar Style-->
    <Style TargetType="ProgressBar" x:Key="MetroProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource HighlightBrush}" />
        <Setter Property="Background" Value="{DynamicResource GrayBrush4}" />
        <Setter Property="Maximum" Value="100" />
        <Setter Property="Height" Value="10" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ProgressBar">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Determinate" />
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard RepeatBehavior="Forever">
                                        <ObjectAnimationUsingKeyFrames Duration="00:00:00"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       Storyboard.TargetName="IndeterminateRoot">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="00:00:00"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       Storyboard.TargetName="DeterminateRoot">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="X"
                                                                       Storyboard.TargetName="xTransform">
                                            <SplineDoubleKeyFrame KeyTime="0"
                                                                  Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:.35"
                                                                  Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="PART_Track"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}" />
                        <Grid x:Name="ProgressBarRootGrid">
                            <Grid x:Name="IndeterminateRoot"
                                  Visibility="Collapsed">
                                <Rectangle x:Name="IndeterminateSolidFill"
                                           Margin="{TemplateBinding BorderThickness}"
                                           Opacity="1"
                                           RenderTransformOrigin="0.5,0.5"
                                           StrokeThickness="0"
                                           Fill="{DynamicResource BrandingBrush}" />
                                <Rectangle x:Name="IndeterminateGradientFill"
                                           Margin="{TemplateBinding BorderThickness}"
                                           Opacity="0.7"
                                           StrokeThickness="1">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="0,1"
                                                             MappingMode="Absolute"
                                                             SpreadMethod="Repeat"
                                                             StartPoint="20,1">
                                            <LinearGradientBrush.Transform>
                                                <TransformGroup>
                                                    <TranslateTransform X="0" x:Name="xTransform" />
                                                    <SkewTransform AngleX="-30" />
                                                </TransformGroup>
                                            </LinearGradientBrush.Transform>
                                            <GradientStop Color="{DynamicResource ProgressIndeterminateColor1}"
                                                          Offset="0" />
                                            <GradientStop Color="{DynamicResource ProgressIndeterminateColor2}"
                                                          Offset="0.651" />
                                            <GradientStop Color="{DynamicResource ProgressIndeterminateColor3}"
                                                          Offset="0.093" />
                                            <GradientStop Color="{DynamicResource ProgressIndeterminateColor4}"
                                                          Offset="0.548" />
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                            </Grid>
                            <Grid x:Name="DeterminateRoot"
                                  Margin="1">
                                <Border x:Name="PART_Indicator"
                                        Background="{DynamicResource BrandingBrush}"
                                        HorizontalAlignment="Left"
                                        Margin="-1">
                                    <Rectangle x:Name="GradientFill"
                                               Opacity="0.7"
                                               Visibility="Collapsed">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush EndPoint="0,1"
                                                                 MappingMode="Absolute"
                                                                 SpreadMethod="Repeat"
                                                                 StartPoint="20,1">
                                                <LinearGradientBrush.Transform>
                                                    <TransformGroup>
                                                        <TranslateTransform X="0" />
                                                        <SkewTransform AngleX="-30" />
                                                    </TransformGroup>
                                                </LinearGradientBrush.Transform>
                                                <GradientStop Color="{DynamicResource ProgressIndeterminateColor1}"
                                                              Offset="0" />
                                                <GradientStop Color="{DynamicResource ProgressIndeterminateColor2}"
                                                              Offset="0.651" />
                                                <GradientStop Color="{DynamicResource ProgressIndeterminateColor3}"
                                                              Offset="0.093" />
                                                <GradientStop Color="{DynamicResource ProgressIndeterminateColor4}"
                                                              Offset="0.548" />
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                </Border>
                            </Grid>
                        </Grid>

                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="LayoutTransform" TargetName="Root">
                                <Setter.Value>
                                    <RotateTransform Angle="-90" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsIndeterminate" Value="true">
                            <Setter Property="Visibility" TargetName="IndeterminateRoot" Value="Visible" />
                            <Setter Property="Visibility" TargetName="DeterminateRoot" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderThickness" Value="1" />
    </Style>
</ResourceDictionary>